<?php get_header(); ?>

<?php get_sidebar(); ?>

<?php include (TEMPLATEPATH . '/right-sidebar.php'); ?>



<div id="content">
<p>
<script type="text/javascript"><!--
google_ad_client = "<?php google_pub_id();?>";
google_ad_width = 250;
google_ad_height = 250;
google_ad_format = "250x250_as";
google_ad_type = "text_image";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "00688B";
google_color_url = "808080";
google_color_text = "808080";;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "<?php google_pub_id();?>";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text_image";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "00688B";
google_color_url = "808080";
google_color_text = "808080";;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

	<div class="navigation">

		<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>

		<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>

	</div>

	<div class="post">

<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>



		<p class="date"><?php _e('Posted by','andreas09'); ?> <?php if (get_the_author_url()) { ?><a href="<?php the_author_url(); ?>"><?php the_author(); ?></a><?php } else { the_author(); } ?> <?php _e('on','andreas09'); ?> <?php the_time (__('F jS, Y','andreas09')) ?></p>



		<div class="entrytext">

			<?php the_content(__('Read the rest of this entry &raquo;','andreas09')); ?>

</div>



			<?php link_pages('<p><strong>'.__('Pages:','andreas09').'</strong> ', '</p>', 'number'); ?>

			<p class="postmetadata">

				 		<?php _e('This entry was posted on','andreas09'); ?> <?php the_time(__('l, F jS, Y','andreas09')) ?> <?php _e('um','andreas09'); ?> <?php the_time() ?>

						<?php _e('and is filed under','andreas09'); ?> <?php the_category(', ') ?>.

						<?php _e('You can follow any responses to this entry through the','andreas09'); ?> <?php comments_rss_link('RSS 2.0'); ?> <?php _e('feed','andreas09'); ?>. 

						

						<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {

							// Both Comments and Pings are open ?>

							<?php _e('You can','andreas09'); ?> <a href="#respond"><?php _e('leave a response','andreas09'); ?></a>, <?php _e('or','andreas09'); ?> <a href="<?php trackback_url(true); ?>" rel="trackback"><?php _e('trackback','andreas09'); ?></a> <?php _e('from your own site','andreas09'); ?>.

						

						<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {

							// Only Pings are Open ?>

							<?php _e('Responses are currently closed, but you can','andreas09'); ?> <a href="<?php trackback_url(true); ?> " rel="trackback"><?php _e('trackback','andreas09'); ?></a> <?php _e('from your own site','andreas09'); ?>.

						

						<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {

							// Comments are open, Pings are not ?>

							<?php _e('You can skip to the end and leave a response. Pinging is currently not allowed.','andreas09'); ?>

			

						<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {

							// Neither Comments, nor Pings are open ?>

							<?php _e('Both comments and pings are currently closed.','andreas09'); ?>			

						

						<?php } edit_post_link(__('Edit this entry.','andreas09'),'',''); ?>

			</p>		

		

	</div>

		

	<?php comments_template(); ?>

<div class="bottomnavigation">

			<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>

			<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>

		</div>

	<?php endwhile; else: ?>

		<p><?php _e('Sorry, no posts matched your criteria.','andreas09'); ?></p>

	

	<?php endif; ?>

<?php

$this_post = $post;

$category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;

$posts = get_posts('numberposts=6&offset=0&orderby=post_date&order=DESC&category='.$category);

$count = 0;

foreach ( $posts as $post ) {

if ( $post->ID == $this_post->ID || $count == 5) {

unset($posts[$count]);

}else{

$count ++;

}

}

?>

<?php if ( $posts ) : ?>

<div class="post">

<h3>Related articles</h3>

<ul>

<?php foreach ( $posts as $post ) : ?>

<li><a rel="nofollow" href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("\n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a> (<?php the_time('F jS, Y') ?>)</li>

<?php endforeach // $posts as $post ?>

</ul>

</div>

<?php endif // $posts ?>



</div>



<?php get_footer(); ?>

